﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using EnumUtils;
using EnumUtils.Extensions;
using EnumUtilsTests;
using EnumUtilsTests.Extensions;
using EnumUtilsTests.TestingEnums;


namespace TestingGrounds
{
  internal class Program
  {
    static int Main( string[] args ) {
      //var testInstance = new FlagEnumUtilitiesTests();
      //testInstance.ForeachEnumFlagDoesOperationExecuteOnAllFlagsTest();

      //GoodFlagEnum flagEnum = GoodFlagEnum.All;
      //IEnumerator<GoodFlagEnum> flagEnumEnumerator = FlagEnumUtilities.GetGenericEnumerator(flagEnum);
      //while (flagEnumEnumerator.MoveNext()) {
      //  Console.Write("{0} ", flagEnumEnumerator.Current.ToString());
      //}

      //GoodFlagEnum testEnum = GoodFlagEnum.f3;
      //Enum testEnum = GoodFlagEnum.f3;
      //testEnum = testEnum.BitShiftLeft<GoodFlagEnum>(2);

      //object enumInABox = GoodFlagEnum.f3;
      //FlagEnumUtilities.BitShiftLeft(enumInABox, 2);
        // RJM: This is a good test. Codify it in the Test suite.
//TODO: Add the above test into the test suite.

      GoodFlagEnum testEnum1 = GoodFlagEnum.f1 | 
                               GoodFlagEnum.f2 | 
                               GoodFlagEnum.f3;
      IEnumerable<GoodFlagEnum> testEnum1Iter = FlagEnumUtilities.ConvertFlagEnumToIEnumerable(testEnum1);

      GoodFlagEnum testEnum2 = GoodFlagEnum.f2 |
                               GoodFlagEnum.f3 |
                               GoodFlagEnum.f4;
      IEnumerable<GoodFlagEnum> testEnum2Iter = FlagEnumUtilities.ConvertFlagEnumToIEnumerable(testEnum2);
      GoodFlagEnum resultsEnum = testEnum1Iter.Intersect(testEnum2Iter).Aggregate(( flag1, flag2 ) => { return flag1 | flag2; });

      Console.WriteLine(resultsEnum);



      Console.WriteLine("Press any key to terminate...");
      Console.ReadKey(true);
      return 0;
    }
  }
}
